package org.finesys.system.api.feignFactory;

import lombok.extern.slf4j.Slf4j;
import org.finesys.system.api.feign.TenantServiceApi;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;


@Component
@Slf4j
@ConditionalOnProperty(name = "feign.enabled", havingValue = "true")
public class TenantServiceApiFallbackFactory implements FallbackFactory<TenantServiceApi> {


    @Override
    public TenantServiceApi create(Throwable cause) {
        return new TenantServiceApi() {
            @Override
            public void validTenant(Long id) {
                log.error("校验租户信息失败:{}", cause.getLocalizedMessage());
            }
        };
    }
}
